# coding : utf-8

"""
生成静态障碍物序列
"""

import carla

from agents.tools.misc import spawn_vehilce_at_point
import random

class SetStaticObstacles:
    def __init__(self, world):
        self.obstacles = None
        self._world = world

    def generate_obstacles(self, location_list):
        bps = self._world.get_blueprint_library().filter("*vehicle")
        number = len(bps)
        for location in location_list:
            bp = bps[random.randint(0, number-1)]
            self.obstacles.append(spawn_vehilce_at_point(self._world, location, bp))